import {lazy} from 'react'
export let mainRouter=[
    {
        path:'/home/shou',
        element:lazy(()=> import('../views/Home/Shou')),
        title:'首页'
    },
    {
        path:'/home/classify',
        element:lazy(()=> import('../views/Home/Classify')),
        title:'分类'
    },
    {
        path:'/home/cart',
        element:lazy(()=> import('../views/Home/Cart')),
        title:'购物车'
    },
    {
        path:'/home/my',
        element:lazy(()=> import('../views/Home/My')),
        title:'我的'
    },
]

const routes=[
    {
        path:'*',
        element:lazy(()=> import('../views/Error')),
    },
    {
        path:'/home',
        element:lazy(()=> import('../views/Home')),
        children:mainRouter
    },
    {
        path:'/detail/:id',
        element:lazy(()=> import('../views/Detail')),
    },
    {
        path:'/detailList',
        element:lazy(()=> import('../views/DetailList')),
     },
     {
        path:'/add',
        element:lazy(()=> import('../views/Add')),
     },
     {
        path:'/edit/:id',
        element:lazy(()=> import('../views/Edit')),
     },
    {
        path:'/login',
        element:lazy(()=> import('../views/Login')),
    },
    {
        from:'/',
        to:'/home/shou'
    }
]

export default routes;